Skip to content

Conversation

@mattmikolay
Copy link
Contributor

@mattmikolay mattmikolay commented Feb 4, 2026

Description

This PR updates the client SDK so that:

  • The feed client supports the exclude option, used to exclude specified fields from the list feed items response payload
  • When a new socket event of type "new-message" is received, the request we make to the list feed items endpoint automatically excludes the meta field from its response. meta contains the badge counts, which are already present on the socket event payload, so querying for meta is redundant.

Todos

  • Merge knocklabs/switchboard#5467
  • Merge knocklabs/switchboard#5478

Checklist

  • Tests have been added for new features or major refactors to existing features.

Loom demo

https://www.loom.com/share/56c2bb427c31485ea8b837c3c416be04

@vercel
Copy link

vercel bot commented Feb 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
javascript-ms-teams-connect-example Ready Ready Preview, Comment Feb 10, 2026 8:26pm
javascript-nextjs-example Ready Ready Preview, Comment Feb 10, 2026 8:26pm
javascript-slack-connect-example Ready Ready Preview, Comment Feb 10, 2026 8:26pm
javascript-slack-kit-example Ready Ready Preview, Comment Feb 10, 2026 8:26pm

Request Review

@linear
Copy link

linear bot commented Feb 4, 2026

@changeset-bot
Copy link

changeset-bot bot commented Feb 4, 2026

🦋 Changeset detected

Latest commit: b67f436

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@knocklabs/client Minor
client-example Patch
guide-example Patch
@knocklabs/expo Patch
@knocklabs/react-core Patch
@knocklabs/react-native Patch
@knocklabs/react Patch
@knocklabs/expo-example Patch
ms-teams-connect-example Patch
nextjs-app-dir-example Patch
nextjs-example Patch
slack-connect-example Patch
slack-kit-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mattmikolay mattmikolay changed the title Update feed client to support exclude chore(KNO-11486): Feb 4, 2026
Copy link
Contributor Author

mattmikolay commented Feb 4, 2026

@mattmikolay mattmikolay changed the title chore(KNO-11486): chore(KNO-11486): exclude metadata when refetching feed after new message received Feb 4, 2026
@mattmikolay
Copy link
Contributor Author

@cursor review

@mattmikolay
Copy link
Contributor Author

@cursor review

@mattmikolay mattmikolay changed the base branch from mattmik-kno-11394-support-compact-mode-for-feeds to graphite-base/853 February 10, 2026 20:10
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

"inserted_at.gte"?: string;
"inserted_at.lte"?: string;
"inserted_at.gt"?: string;
"inserted_at.lt"?: string;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FeedResponse.meta type not updated to allow undefined

Medium Severity

The FeedResponse interface still defines meta: FeedMetadata as required, but when a socket-triggered fetch sends exclude: "meta", result.body.meta will be undefined at runtime. This response object is broadcast to messages.new legacy event listeners via FeedRealTimeCallback, whose type promises meta is always FeedMetadata. Consumers accessing resp.meta.total_count would get a TypeError. The FeedEventPayload.metadata type was correctly updated to optional, but FeedResponse.meta was not.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

items: response.entries as FeedItem[],
metadata: response.meta as FeedMetadata,
// meta will not be present on the response when __fetchSource is "socket"
metadata: response.meta as FeedMetadata | undefined,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FeedResponse.meta type not updated to reflect optional

Medium Severity

The FeedResponse interface still defines meta: FeedMetadata as required, but after this change, meta can be undefined at runtime when exclude includes "meta" (which now happens automatically for socket-triggered fetches). The cast to FeedMetadata | undefined and the meta ?? state.metadata fallback are runtime workarounds, but the FeedResponse type itself was not updated. Since FeedResponse is a public export used by FeedRealTimeCallback, consumers of the legacy "messages.new" event who access resp.meta.total_count (or similar) will encounter a runtime crash when the fetch is socket-triggered — and TypeScript won't warn them because the type says meta is always present.

Additional Locations (1)

Fix in Cursor Fix in Web

@mattmikolay mattmikolay merged commit 1e75952 into main Feb 10, 2026
16 of 17 checks passed
@mattmikolay mattmikolay deleted the mattmik-kno-11486-sdks-update-js-sdks-to-exclude-branch-count-when-refetching branch February 10, 2026 20:36
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.58%. Comparing base (2af3f5e) to head (b67f436).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #853      +/-   ##
==========================================
+ Coverage   68.45%   68.58%   +0.12%     
==========================================
  Files         193      193              
  Lines        8062     8088      +26     
  Branches     1065     1076      +11     
==========================================
+ Hits         5519     5547      +28     
+ Misses       2518     2516       -2     
  Partials       25       25              
Files with missing lines Coverage Δ
packages/client/src/clients/feed/feed.ts 82.47% <100.00%> (+0.65%) ⬆️
packages/client/src/clients/feed/store.ts 100.00% <100.00%> (ø)
packages/client/src/clients/feed/utils.ts 100.00% <100.00%> (ø)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants